<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('新增市政收入报表')"/>
    <th:block th:include="include :: layout-latest-css"/>
    <th:block th:include="include :: ztree-css"/>
    <th:block th:include="include :: datetimepicker-css"/>
</head>
<style>
    input::-webkit-outer-spin-button, input::-webkit-inner-spin-button {
        -webkit-appearance: none;
    }
    .gray-bg {
        background-color: #FFFFFF;
    }
    form {
        white-space: nowrap;
    }

</style>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content" id="dv">
    <form class="form-horizontal m" id="edit" AUTOCOMPLETE="OFF">
        <input type="hidden" id="programId" name="programId" th:value="${manages.programId}">
        <input type="hidden" id="manageId" name="manageId" th:value="${manages.manageId}">
        <h4 class="form-header h4">基本信息</h4>
        <div class="form-group">
            <div class="col-sm-12">
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">月份：</label>
                    <div class="col-sm-8">
                        <input id="actualMonth" name="actualMonth" class="form-control" placeholder="yyyy-mm-dd"
                               type="text" th:value="${manages.actualMonth}" required>
                    </div>
                </div>
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">人工费 ：</label>
                    <div class="col-sm-8">
                        <input id="laborCost" name="laborCost" class="form-control" placeholder="请输入人工费"
                               type="number" th:value="${manages.laborCost}" required>
                    </div>
                </div>
            </div>
        </div>
        <h4 class="form-header h4 directTotal">直接费（0）元</h4>
        <input type="hidden" id="directTotal" name="directTotal" th:value="${manages.directTotal}">
        <div class="form-group">
            <div class="col-sm-12">
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">临时设施费：</label>
                    <div class="col-sm-8">
                        <input id="tempFacilitiesCost" name="tempFacilitiesCost" class="form-control"
                               placeholder="请输入临时设施费"
                               type="number" th:value="${manages.tempFacilitiesCost}">
                    </div>
                </div>
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">安全措施费：</label>
                    <div class="col-sm-8">
                        <input id="safetyMeasuresCost" name="safetyMeasuresCost" class="form-control"
                               placeholder="请输入安全措施费"
                               type="number" th:value="${manages.safetyMeasuresCost}">
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-12">
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">水电费：</label>
                    <div class="col-sm-8">
                        <input id="waterEleCost" name="waterEleCost" class="form-control"
                               placeholder="请输入水电费"
                               type="number" th:value="${manages.waterEleCost}">
                    </div>
                </div>
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">实验检测费：</label>
                    <div class="col-sm-8">
                        <input id="testCost" name="testCost" class="form-control"
                               placeholder="请输入实验检测费"
                               type="number" th:value="${manages.testCost}">
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-12">
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">二次搬运费：</label>
                    <div class="col-sm-8">
                        <input id="secHandCost" name="secHandCost" class="form-control"
                               placeholder="请输入二次搬运费"
                               type="number" th:value="${manages.secHandCost}">
                    </div>
                </div>
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">报建费：</label>
                    <div class="col-sm-8">
                        <input id="constructCost" name="constructCost" class="form-control"
                               placeholder="请输入报建费"
                               type="number" th:value="${manages.constructCost}">
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-12">
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">其他直接费用：</label>
                    <div class="col-sm-8">
                        <input id="otherCost" name="otherCost" class="form-control"
                               placeholder="请输入其他直接费用"
                               type="number" th:value="${manages.otherCost}">
                    </div>
                </div>
            </div>
        </div>
        <h4 class="form-header h4 indirectTotal">间接费（0）元</h4>
        <input type="hidden" id="indirectTotal" name="indirectTotal" th:value="${manages.indirectTotal}">
        <div class="form-group">
            <div class="col-sm-12">
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">工伤补助费：</label>
                    <div class="col-sm-8">
                        <input id="industrialInjuryCost" name="industrialInjuryCost" class="form-control"
                               placeholder="请输入工伤补助费"
                               type="number" th:value="${manages.industrialInjuryCost}">
                    </div>
                </div>
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">工程维修费：</label>
                    <div class="col-sm-8">
                        <input id="projectMainCost" name="projectMainCost" class="form-control"
                               placeholder="请输入工程维修费"
                               type="number" th:value="${manages.projectMainCost}">
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-12">
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">罚没支出：</label>
                    <div class="col-sm-8">
                        <input id="punishmentCost" name="punishmentCost" class="form-control"
                               placeholder="请输入罚没支出"
                               type="number" th:value="${manages.punishmentCost}">
                    </div>
                </div>
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">劳动保护费：</label>
                    <div class="col-sm-8">
                        <input id="laborProtectCost" name="laborProtectCost" class="form-control"
                               placeholder="请输入劳动保护费"
                               type="number" th:value="${manages.laborProtectCost}">
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-12">
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">物料消耗费：</label>
                    <div class="col-sm-8">
                        <input id="materialConsumpCost" name="materialConsumpCost" class="form-control"
                               placeholder="请输入物料消耗费"
                               type="number" th:value="${manages.materialConsumpCost}">
                    </div>
                </div>
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">低值易耗品摊销：</label>
                    <div class="col-sm-8">
                        <input id="consumCost" name="consumCost" class="form-control"
                               placeholder="请输入劳动保护费"
                               type="number" th:value="${manages.consumCost}">
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-12">
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">诉讼费：</label>
                    <div class="col-sm-8">
                        <input id="legalCost" name="legalCost" class="form-control"
                               placeholder="请输入诉讼费"
                               type="number" th:value="${manages.legalCost}">
                    </div>
                </div>
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">财务费用：</label>
                    <div class="col-sm-8">
                        <input id="financialCost" name="financialCost" class="form-control"
                               placeholder="请输入财务费用"
                               type="number" th:value="${manages.financialCost}">
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-12">
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">中介机构：</label>
                    <div class="col-sm-8">
                        <input id="agencyCost" name="agencyCost" class="form-control"
                               placeholder="请输入中介机构"
                               type="number" th:value="${manages.agencyCost}">
                    </div>
                </div>
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">折旧费：</label>
                    <div class="col-sm-8">
                        <input id="depreciationCharge" name="depreciationCharge" class="form-control"
                               placeholder="请输入折旧费"
                               type="number" th:value="${manages.depreciationCharge}">
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-12">
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">其他间接费：</label>
                    <div class="col-sm-8">
                        <input id="otherOverhead" name="otherOverhead" class="form-control"
                               placeholder="请输入其他间接费"
                               type="number" th:value="${manages.otherOverhead}">
                    </div>
                </div>
            </div>
        </div>
        <h4 class="form-header h4 adminTotal">行政费（0）元</h4>
        <input type="hidden" id="adminTotal" name="adminTotal" th:value="${manages.adminTotal}">
        <div class="form-group">
            <div class="col-sm-12">
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">差旅费：</label>
                    <div class="col-sm-8">
                        <input id="travelCost" name="travelCost" class="form-control"
                               placeholder="请输入差旅费"
                               type="number" th:value="${manages.travelCost}">
                    </div>
                </div>
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">办公费：</label>
                    <div class="col-sm-8">
                        <input id="officeCost" name="officeCost" class="form-control"
                               placeholder="请输入办公费"
                               type="number" th:value="${manages.officeCost}">
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-12">
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">福利费-管理人员：</label>
                    <div class="col-sm-8">
                        <input id="welfareUser" name="welfareUser" class="form-control"
                               placeholder="请输入福利费-管理人员"
                               type="number" th:value="${manages.welfareUser}">
                    </div>
                </div>
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">水电食堂-机械手：</label>
                    <div class="col-sm-8">
                        <input id="welfareMani" name="welfareMani" class="form-control"
                               placeholder="请输入水电食堂-机械手"
                               type="number" th:value="${manages.welfareMani}">
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-12">
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">招待费-监理：</label>
                    <div class="col-sm-8">
                        <input id="welfareSupervisor" name="welfareSupervisor" class="form-control"
                               placeholder="请输入招待费-监理"
                               type="number" th:value="${manages.welfareSupervisor}">
                    </div>
                </div>
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">招待费：</label>
                    <div class="col-sm-8">
                        <input id="entertainmentCost" name="entertainmentCost" class="form-control"
                               placeholder="请输入招待费"
                               type="number" th:value="${manages.entertainmentCost}">
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-12">
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">礼品领用：</label>
                    <div class="col-sm-8">
                        <input id="giftCost" name="giftCost" class="form-control"
                               placeholder="请输入礼品领用"
                               type="number" th:value="${manages.giftCost}">
                    </div>
                </div>
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">车辆使用费：</label>
                    <div class="col-sm-8">
                        <input id="vehicleCost" name="vehicleCost" class="form-control"
                               placeholder="请输入车辆使用费"
                               type="number" th:value="${manages.vehicleCost}">
                    </div>
                </div>
            </div>
        </div>
        <h4 class="form-header h4 manpowerTotal">人力费用（0）元</h4>
        <input type="hidden" id="manpowerTotal" name="manpowerTotal" th:value="${manages.manpowerTotal}">
        <div class="form-group">
            <div class="col-sm-12">
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">人员薪资：</label>
                    <div class="col-sm-8">
                        <input id="personSalary" name="personSalary" class="form-control"
                               placeholder="请输入人员薪资"
                               type="number" th:value="${manages.personSalary}">
                    </div>
                </div>
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">社保：</label>
                    <div class="col-sm-8">
                        <input id="security" name="security" class="form-control"
                               placeholder="请输入社保"
                               type="number" th:value="${manages.security}">
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-12">
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">公积金：</label>
                    <div class="col-sm-8">
                        <input id="accumulation" name="accumulation" class="form-control"
                               placeholder="请输入公积金"
                               type="number" th:value="${manages.accumulation}">
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>


<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<th:block th:include="include :: select2-js"/>

<script th:inline="javascript">
    var prefix = ctx + "manage";
    var directTotal;//直接费总计
    var indirectTotal;//间接费总计
    var adminTotal;//行政总计
    var manpowerTotal;//人力总计

    $(function () {

        layui.use('laydate', function () {
            var laydate = layui.laydate;
            laydate.render({
                elem: '#actualMonth',
                type: 'month'
            });
        });

        $(".directTotal").text("直接费（" + $("#directTotal").val() + "）元");
        $(".indirectTotal").text("间接费（" + $("#indirectTotal").val() + "）元");
        $(".adminTotal").text("行政费（" + $("#adminTotal").val() + "）元");
        $(".manpowerTotal").text("人力费用（" + $("#manpowerTotal").val() + "）元");

        $("input").change(function () {
            directTotal = (Number($("#tempFacilitiesCost").val()) + Number($("#safetyMeasuresCost").val()) +
                Number($("#waterEleCost").val()) + Number($("#testCost").val()) +
                Number($("#secHandCost").val()) + Number($("#constructCost").val()) +
                Number($("#otherCost").val())).toFixed(2);

            indirectTotal = (Number($("#industrialInjuryCost").val()) + Number($("#projectMainCost").val()) +
                Number($("#punishmentCost").val()) + Number($("#laborProtectCost").val()) +
                Number($("#materialConsumpCost").val()) + Number($("#consumCost").val()) +
                Number($("#legalCost").val()) + Number($("#financialCost").val()) +
                Number($("#agencyCost").val()) + Number($("#depreciationCharge").val()) +
                Number($("#otherOverhead").val())).toFixed(2);

            adminTotal = (Number($("#travelCost").val()) + Number($("#officeCost").val()) +
                Number($("#welfareUser").val()) + Number($("#welfareMani").val()) +
                Number($("#welfareSupervisor").val()) + Number($("#entertainmentCost").val()) +
                Number($("#giftCost").val()) + Number($("#vehicleCost").val())).toFixed(2);

            manpowerTotal = (Number($("#personSalary").val()) + Number($("#security").val()) +
                Number($("#accumulation").val())).toFixed(2);

            $("#directTotal").val(directTotal);
            $("#indirectTotal").val(indirectTotal);
            $("#adminTotal").val(adminTotal);
            $("#manpowerTotal").val(manpowerTotal);

            $(".directTotal").text("直接费（" + directTotal + "）元");
            $(".indirectTotal").text("间接费（" + indirectTotal + "）元");
            $(".adminTotal").text("行政费（" + adminTotal + "）元");
            $(".manpowerTotal").text("人力费用（" + manpowerTotal + "）元");
        })
    })

    function submitHandler() {
        if ($.validate.form()) {
            var data = $("#edit").serializeArray();
            $.operate.save(prefix + "/edit", data);
            parent.refresh();
        }
    }

</script>
</body>
</html>